package controllers

import (
	"github.com/astaxie/beego"
	"fmt"
"wcy-xmt-api/models"
)

// 评论
type CommentController struct {
	beego.Controller
}

// @Title comment
// @Description 发表评论
// @Param app form int true "App编号"
// @Param type form int true "类型，0视频，1图文"
// @Param content form int true "评论内容"
// @Param session_id form string true "会话id"
// @Param uid form int true "用户id"
// @Param token form int true "登陆成功返回的token"
// @Success 200 {object} models.ResStatus
// @Success 200 {object} models.SendStatus
// @router /send [post]
func (this *CommentController) Comment() {
	fmt.Println("run CommentController Comment")
	resStatus := &models.ResStatus{}
	startStatus := &models.SendStatus{}
	startStatus.Code = 0
	startStatus.ErrMsg = ""

	resStatus.Code = 200
	resStatus.Data = startStatus
	resStatus.ErrMsg = "OK"

	this.Data["json"] = resStatus
	this.ServeJson()
}

// @Title comment
// @Description 获取评论
// @Param app form int true "App编号"
// @Param type form int true "类型，0视频，1图文"
// @Param session_id form string true "会话id"
// @Param size form int false "请求条目数"
// @Param current_page form int false "当前Page，在分页时候需要使用"
// @Success 200 {object} models.ResStatus
// @Success 200 {object} models.CommentInfo
// @router /list [post]
func (this *CommentController) GetComment() {
	fmt.Println("run CommentController GetComment")
	resStatus := &models.ResStatus{}
	commentInfo := &models.CommentStatus{}

	comments := []*models.CommentInfo{}
	comment := &models.CommentInfo{}
	comment.Content = "不错啊，很想去参加，可惜没有时间，(＞﹏＜)！！！！！！！！！！"
	comment.Id = 1
	comment.NickName = "杨颖"
	comments = append(comments,comment)
	comment = &models.CommentInfo{}
	comment.Content = "不错啊，很想去参加，可惜没有时间，(＞﹏＜)！！！！！！！！！！"
	comment.Id = 2
	comment.NickName = "杨颖"
	comments = append(comments,comment)

	commentInfo.Code = 0
	commentInfo.CurPage = 1
	commentInfo.ErrMsg = ""
	commentInfo.Total = 10
	commentInfo.Data = comments

	resStatus.Code = 200
	resStatus.Data = commentInfo
	resStatus.ErrMsg = "OK"

	this.Data["json"] = resStatus
	this.ServeJson()
}